﻿@{
    ViewBag.Title = "RoleList";
    Layout = "~/Views/Shared/_LayoutChild.cshtml";
}
@section head {
    @if (false)
    {<script src="~/Scripts/jquery-1.6.4-vsdoc.js" type="text/javascript"></script>}
    <link href="@Url.Content("~/Content/zTreeStyle/zTreeStyle.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.ztree.all-3.0.min.js")" type="text/javascript"></script>
    @Html.Partial("_JqGrid")
    <script language="javascript" type="text/javascript">
        var selectId = "";
        var gridId = "#tableId";
        $(document).ready(function () {
            funGridInit();
        });
        function Search() {
            //查询
            $(gridId).setGridParam({ page: 1 });
            $(gridId).trigger("reloadGrid");
        }


        function funGridInit() {
            //初始化表格
            var option = {
                height: $("#divGridContainer").height() - 51,
                width: $("#divGridContainer").width() - 2,
                url: '@Url.Content("~/SystemManage/Sbrq/GetSbrqList")',
                autowidth: false,
                datatype: "json",
                sortname: 'key',
                sortorder: 'desc',
                cellEdit: true,
                cellsubmit: 'clientArray',
                colModel: [
                { label: '报表类型', name: 'Comment', width: 100 },
                { label: '延迟上报天数', name: 'Value', align: "right", width: 120, editable: true, formatter: 'intFmatter', editrules: { required: true, integer: true, minValue: 0, maxValue: 720} }, //, editable: true, formatter: 'integer'
                {label: '指定日', name: 'FormatDay', align: "right", width: 120, editable: true, formatter: 'intFmatter', editrules: { required: true, integer: true, minValue: 0, maxValue: 28} },
                {hidden: true, name: 'Key' }
   	            ],
                onSelectRow: function (rowid, cellname, value, iRow, iCol) {
                },
                ondblClickRow: function (rowid) {

                },
                afterSaveCell: function (rowid, celname, value, iRow, iCol) {
                    if (celname == "Value" || celname == "FormatDay") {
                        var Url = "/SystemManage/Sbrq/Save";
                        //保存参数
                        var data = { Comment: $(gridId).getCell(iRow, "Comment"),
                            Value: $(gridId).getCell(iRow, "Value"), FormatDay: $(gridId).getCell(iRow, "FormatDay")
                        }
                        $.post(Url, data, function (d) {
                            if (d == "") {
                                $(gridId).trigger("reloadGrid");
                            }
                            else {
                                alert("保存失败:" + d);
                            }
                        });

                    }
                },
                beforeRequest: function (d) {
                    // $(gridId).jqGrid('setGridParam', { postData: data });
                }
            };
            var o = jqGridHelper.getConfig("#pageId", option);
            $(gridId).jqGrid(o);
        }
    </script>
}
<!--头部导航,不用时可以去掉-->
<div class="ui-layout-north">
    <div id="headertitle">
    </div>
    <div class="buttonlist" style="float: right; height: 34px; line-height: 36px; margin-right: 20px;">
        <a onclick="Search()" class="button green"><span class="icon-botton" style="background: url('/Content/16/search.png') no-repeat scroll 0px 4px;">
        </span>查询</a>
    </div>
</div>
<!--左侧导航，不用时直接去掉-->
<!--主窗体，页面都需要的div-->
<div id="divGridContainer" class="ui-layout-center" style="overflow: auto;">
    <table id="tableId">
    </table>
    <div id="pageId">
    </div>
</div>
